def is_prime(x):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            return 0
    return 1
m=0
for j in range(2,20000):
    if is_prime(j)==1:
        m=m+1
        print(j,' ',end="")
        if m%5==0:
            print('\n')
